// SmartPtr.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>

using namespace std;
class MockBase
{
public:
	MockBase()
		: name("MockBase")
	{
		IncreaseCount();
	}

	virtual ~MockBase() {}

	const char* GetClassName()
	{
		char tempName[20];
		sprintf(tempName, "%d\0", num);

		return name.append(tempName).c_str();				
	}

	static void ClearCount() {num = 0;}

	virtual int VirtualTest()
	{
		return 1;
	}
protected:
	static void IncreaseCount() {++num; }
	string name;
	static int num;

	int k;
};

int MockBase::num = 0;

class MockDerive : public MockBase
{
public:
	MockDerive() :
	  MockBase()
	  {
		  IncreaseCount();
		  name = "MockDerive";
	  }

	  virtual ~MockDerive() {}

	  virtual int VirtualTest()
	  {
		  return 2;
	  }

	  int y;
	  int j;
};

int _tmain(int argc, _TCHAR* argv[])
{
	MockBase *pBase = new MockBase;
	MockDerive * pDerive = new MockDerive;

	pBase = pDerive;
	int k = sizeof(*pBase);
	int k2 = sizeof(*pDerive);

	return 0;
}

